﻿using Topshelf;

namespace Wombat.ServerHost
{
    public class Program
    {
        /// <summary>
        /// Starts the windows server host program.
        /// </summary>
        /// <param name="args">The args.</param>
        static void Main(string[] args)
        {
            HostFactory.Run(x =>
                {
                    x.Service<ServerHostManager>(s =>
                        {
                            s.ConstructUsing(name => new ServerHostManager());
                            s.WhenStarted(tc => tc.StartAsync().Wait());
                            s.WhenStopped(tc => tc.StopAsync().Wait());
                        });
                    x.RunAsPrompt();

                    x.SetDescription("My crappy service");
                    x.SetDisplayName("My crap");
                    x.SetServiceName("CrapService");
                });
        }
    }
}
